package cn.oms.oms.controller;


import cn.oms.oms.entity.Account;
import cn.oms.oms.entity.Patient;
import cn.oms.oms.service.IAccountService;
import cn.oms.oms.service.IPatientService;
import cn.oms.oms.vo.AccountVo;
import cn.oms.oms.vo.PatientReqVo;
import cn.oms.oms.vo.PatientVo;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author AllenChen曾晨
 * @since 2022-04-29
 */
@RestController
@RequestMapping("/oms/account")
@Slf4j
public class AccountController {

    @Autowired
    public IAccountService accountService;

    /**
     * 根据查询条件查询缴费单列表
     * @param accountVo
     * @return
     */
    @PostMapping("/selectAccountList")
    public PageInfo<Account> selectAccountList(AccountVo accountVo){
        if(accountVo.getPageNum()==null||accountVo.getPageNum()==0){
            accountVo.setPageNum(1);
        }
        if(accountVo.getPageSize()==null||accountVo.getPageSize()==0){
            accountVo.setPageSize(10);
        }
        log.debug("接收到信息:{}",accountVo);
        PageInfo<Account> pageInfo = accountService.selectAccountList(accountVo);
        return pageInfo;
    }

    /**
     * 查询缴费单详情
     * @param accountVo
     * @return
     */
    @PostMapping("/selectAccountDetail")
    public Account selectAccountDetail(AccountVo accountVo){
        log.debug("接收到信息:{}",accountVo);
        Account account = accountService.selectAccountDetail(accountVo);
        return account;
    }

    /**
     * 缴费单缴费
     * @param accountVo
     * @return
     */
    @PostMapping("/accountPay")
    public String accountPay(AccountVo accountVo){
        log.debug("接收到信息:{}",accountVo);
        String res = accountService.accountPay(accountVo);
        return res;
    }

}
